package com.iman.common.springmvc;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.view.freemarker.FreeMarkerView;

import com.iman.common.util.NetworkUtils;

public class FreeMarkerViewExt extends FreeMarkerView {
    public static final String BASE_PATH = "basePath";
    private String imageDomain;
    public String getImageDomain() {
		return imageDomain;
	}
	public void setImageDomain(String imageDomain) {
		this.imageDomain = imageDomain;
	}
	@Override
    protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception {
        String contextPath = NetworkUtils.getBasePath(request); //request.getContextPath();
        if (this.logger.isDebugEnabled()) {
            logger.debug("contextPath=" + contextPath);
        }
        model.put(BASE_PATH, contextPath);
       // model.put("ImageServer", "http://127.0.0.1:8081/web7img/");
        model.put("ImageServer", imageDomain);
    }
}
